use "/Users/joshuazingher/Desktop/AZ-CA paper/Field Poll 1992-2006.dta"

drop b1- b14

gen white=1

replace white=0 if Black==1

replace white=0 if Latino==1

replace white=0 if Asian==1

gen DemvoteGov = . 

replace DemvoteGov = 1 if GOVVOTE==2

replace DemvoteGov = 0 if GOVVOTE==1

gen d1998 = 0

replace d1998 =1 if YEAR==1998

gen d2002 =0

replace d2002 = 1 if YEAR==2002

gen d2006 =0

replace d2006 =1 if YEAR==2006

gen L1994 = d1994*Latino

gen L1998 = d1998*Latino

gen L2002 = d2002*Latino

gen L2006 = d2006*Latino

gen RegDEM=0

gen RegIND=0

replace RegIND = 1 if PARTYREG==3 | PARTYREG==4

replace RegDEM=1 if PARTYREG==2


gen white1996 = white* d1996

gen white2000 = white* d2000

gen white2004 = white* d2004

logit DEMvote IDEOL7 RegDEM RegIND SEX AGEYRS Latino Black Asian d1996 d2000 d2004 L1996 L2000 L2004 QUINTILE EDUC4 
outreg2 using Cali, replace
logit DemvoteGov IDEOL7 RegDEM RegIND SEX AGEYRS Latino Black Asian d1998 d2002 d2006 L1998 L2002 L2006 QUINTILE EDUC4  
outreg2 using Cali

///Latino Pres -IND
estsimp logit DEMvote IDEOL7 RegDEM RegIND SEX AGEYRS Latino Black Asian d1996 d2000 d2004 L1996 L2000 L2004 QUINTILE EDUC4  
setx (Black Asian d1996 d2000 d2004 L1996 L2000 L2004 SEX) 0 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d2000 d2004 L2000 L2004 SEX) 0 d1996  1 L1996 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1996 d2004 L1996 L2004 SEX) 0 d2000  1 L2000 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1996 d2000 L1996 L2000 SEX) 0 d2004  1 L2004 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
///Latino Pres-Dem
setx (Black Asian d1996 d2000 d2004 L1996 L2000 L2004 SEX) 0 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d2000 d2004 L2000 L2004 SEX) 0 d1996  1 L1996 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1996 d2004 L1996 L2004 SEX) 0 d2000  1 L2000 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1996 d2000 L1996 L2000 SEX) 0 d2004  1 L2004 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)

drop b1- b17

/// Latino Gov-IND
estsimp logit DemvoteGov IDEOL7 RegDEM RegIND SEX AGEYRS Latino Black Asian d1998 d2002 d2006 L1998 L2002 L2006 QUINTILE EDUC4  
setx (Black Asian d1998 d2002 d2006 L1998 L2002 L2006 SEX) 0 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d2002 d2006 L2002 L2006 SEX) 0 d1998  1 L1998 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1998 d2002 L1998 L2006 SEX) 0 d2002  1 L2002 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1998 d2002 L1998 L2002 SEX) 0 d2006  1 L2006 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 0 RegIND 1 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
///Latino Gov-Dem
setx (Black Asian d1998 d2002 d2006 L1998 L2002 L2006 SEX) 0 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d2002 d2006 L2002 L2006 SEX) 0 d1998  1 L1998 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1998 d2006 L1998 L2006 SEX) 0 d2002  1 L2002 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)
setx (Black Asian  d1998 d2002 L1998 L2002 SEX) 0 d2006  1 L2006 1 IDEOL7 3.63 AGEYRS 55.3 Latino 1 RegDEM 1 RegIND 0 QUINTILE 2.5 EDUC4 2
simqi, prval(1)




clear

import excel "/Users/joshuazingher/Desktop/AZ-CA paper/Predicted Latino Vote.xlsx", sheet("Sheet1") clear


twoway rcap UB LB Year if Dem==1 & Pres==1 , xlabel(1992 1996 2000 2004) ytitle(Probablity of Voting for Democratic Candidate)  || scatter XB Year if Dem==1 & Pres==1 
 graph save Graph "/Users/joshuazingher/Desktop/AZ-CA paper/Field Poll Graph.gph", replace
twoway rcap UB LB Year if Dem==0 & Pres==1 , xlabel(1992 1996 2000 2004) ytitle(probablity of voting for Democratic Candidate)  || scatter XB Year if Dem==0 & Pres==1 

twoway rcap UB LB Year if Dem==1 & Pres==0 , xlabel(1994 1998 2002 2006) ytitle(probablity of voting for Democratic Candidate)  || scatter XB Year if Dem==1 & Pres==0 

twoway rcap UB LB Year if Dem==0 & Pres==0 , xlabel(1994 1998 2002 2006) ytitle(probablity of voting for Democratic Candidate)  || scatter XB Year if Dem==0 & Pres==0 


clear

use "/Users/joshuazingher/Desktop/AZ-CA paper/Field Poll 1992-2006.dta"


